package com.xsg.printer.core.enums;

import java.awt.*;

public enum ColorEnum {
    WHITE(1, Color.WHITE),

    LIGHT_GRAY(2, Color.LIGHT_GRAY),

    GRAY(3, Color.GRAY),

    DARK_GRAY(4, Color.DARK_GRAY),

    BLACK(5, Color.BLACK),

    PINK(6, Color.PINK),

    ORANGE(7, Color.ORANGE),

    YELLOW(8, Color.YELLOW),

    GREEN(9, Color.GREEN),

    MAGENTA(10, Color.MAGENTA),

    CYAN(11, Color.CYAN),

    BLUE(12, Color.BLUE),

    RED(13, Color.RED),
    ;

    private Integer type;

    private Color color;

    ColorEnum(int type, Color color) {
        this.type = type;
        this.color = color;
    }

    public Integer getType() {
        return type;
    }

    public Color getColor() {
        return color;
    }

    public static Color getColorByType(Integer type) {
        for (ColorEnum value : values()) {
            if(value.getType().equals(type)){
                return value.getColor();
            }
        }
        return ColorEnum.BLACK.getColor();
    }
}
